package com.eya;

import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.core.env.Environment;

/**
 * TODO(这个类的作用)
 *
 * @auther: luolin
 * @since: 2018/1/22 15:41
 */
@SpringBootApplication
//@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class, HibernateJpaAutoConfiguration.class})
@EnableAutoConfiguration//可以从逐层的往下搜索各个加注解的类
@MapperScan("com.eya.mapper")//将项目中对应的mapper类的路径加进来就可以了
@EnableDiscoveryClient  //激活eureka中的DiscoveryClient实现
public class Application {


	public static void main(String[] args) {
		SpringApplication.run(Application.class, args);
	}

	/**
	 * 验证可以从Environment中获得配置
	 */
	@Autowired
	void setEnviroment(Environment env) {
		System.out.println("my-config.appName from env: " + env.getProperty("mysqldb.datasource.username"));
	}
}
